package org.seamon.management.pojo.dto;

import jakarta.validation.constraints.*;
import lombok.Data;


/**
 * @author Simon
 */
@Data
public class UserInsertDto {
    /**
     * 登录账号
     */
    @NotBlank(message = "登录账号不能为空")
    private String username;

    /**
     * 密码
     */
    @NotBlank(message = "密码不能为空")
    @Size(min = 6, max = 20, message = "密码长度必须在6到20之间")
    @Pattern(regexp = "^[a-zA-Z0-9_]{6,20}$", message = "密码只能包含字母、数字和下划线")
    private String password;

    /**
     * 真实姓名
     */
    @NotEmpty(message = "真实姓名不能为空")
    @Size(min = 2, max = 10, message = "真实姓名长度必须在2到10之间")
    private String realName;

    /**
     * 所属部门id
     */
    @NotNull(message = "所属部门不能为空")
    private Long deptId;

    /**
     * 手机号
     */
    @NotBlank(message = "手机号不能为空")
    @Size(max = 11)
    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式不正确")
    private String phone;

    /**
     * 邮箱
     */
    @NotBlank(message = "邮箱不能为空")
    @Email(message = "邮箱格式不正确")
    private String email;

    /**
     * 性别 0:男 1:女 2:未知
     */
    @NotNull(message = "性别不能为空")
    private Integer gender;

    /**
     * 头像地址
     */
    private String avatar;

    /**
     * 备注
     */
    private String remark;

    @Override
    public String toString() {
        return "UserInsertDto{" +
                "username='" + username + '\'' +
                ", password=******" + '\'' +
                ", realName='" + realName + '\'' +
                ", deptId=" + deptId +
                ", phone='" + phone + '\'' +
                ", email='" + email + '\'' +
                ", gender=" + gender +
                ", avatar='" + avatar + '\'' +
                ", remark='" + remark + '\'' +
                '}';
    }
}
